import useDictStore from '@/store/modules/dict'

const dictStore = useDictStore()

export default function useDict() {
  return {
    getDictByKey: (dictKey: string) => {
      return dictStore.dict[dictKey]
    },
    dictValueToLabel: (dictKey: string, dictValue: string) => {
      return dictStore.dict[dictKey].find((item: any) => item.value == dictValue)?.name ?? dictValue
    }
  }
}